begin tran
declare @upd_id int, @style_no nchar(15), @org_color_id int, @new_color_id int

select @style_no = 'KDNHHT9226', @org_color_id = 351, @new_color_id = 338

select @upd_id = convert(int, var_data) from igs_parm with(updlock) where var_name = 'gv_upd_id'

update pos_sku set color_id = @new_color_id where style_no = @style_no and color_id = @org_color_id
update ms_style set upd_id = @upd_id where style_no = @style_no

update pur_sizecolor set color_id = @new_color_id
 from pur_dtl d, pur_sizecolor q where d.style_no = @style_no and d.pur_id = q.pur_id and d.seq_no = q.seq_no and q.color_id = @org_color_id

select * from pos_sku k, ms_color c 
 where k.style_no = @style_no and k.color_id = c.color_id
rollback tran
select * from pos_sku a join ms_color b on a.color_id = b.color_id and 
a.style_no= 'KDMHHT9226'